#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int left = 1;
    int right = 22;
    int x = 0;
    int* returnSize = &x;
    int i = 0;
    int arr[3000] = { 0 };
    for (i = left; i <= right; i++)
    {
        int a = i;
        int w = 1;
        while (a/=10)
        {
            w++;
        }
        a = i;
        int flag = 0;
        int j = 0;
        for (j = 0; j < w; j++)
        {
            flag = 1;
            int b = a;
            if (a >= 10)
            {
                b = a % 10;
            }
            a /= 10;
            if (b==0 || i % b != 0)
            {
                  flag = 0;
                  break;
            }
        }
        if (flag)
        {
            arr[*returnSize] = i;
            (*returnSize)++;
        }
    }
    int* ret = malloc(sizeof(int) * (*returnSize));
    for (i = 0; i < *returnSize; i++)
    {
        ret[i] = arr[i];
        printf("%d ", ret[i]);
    }
    return 0;
}